package com.ruoyi.web.controller.control;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.control.domain.MonkeyVehicleHistory;
import com.ruoyi.control.service.IMonkeyVehicleHistoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 猴车数据历史Controller
 *
 * @author ruoyi
 * @date 2024-12-13
 */
@RestController
@RequestMapping("/monkeyVehicleHistory/monkeyVehicleHistory")
public class MonkeyVehicleHistoryController extends BaseController
{
    @Autowired
    private IMonkeyVehicleHistoryService monkeyVehicleHistoryService;

    /**
     * 查询猴车数据历史列表
     */
    @PreAuthorize("@ss.hasPermi('monkeyVehicleHistory:monkeyVehicleHistory:list')")
    @GetMapping("/list")
    public TableDataInfo list(MonkeyVehicleHistory monkeyVehicleHistory)
    {
        startPage();
        List<MonkeyVehicleHistory> list = monkeyVehicleHistoryService.selectMonkeyVehicleHistoryList(monkeyVehicleHistory);
        return getDataTable(list);
    }

    /**
     * 导出猴车数据历史列表
     */
    @PreAuthorize("@ss.hasPermi('monkeyVehicleHistory:monkeyVehicleHistory:export')")
    @Log(title = "猴车数据历史", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MonkeyVehicleHistory monkeyVehicleHistory)
    {
        List<MonkeyVehicleHistory> list = monkeyVehicleHistoryService.selectMonkeyVehicleHistoryList(monkeyVehicleHistory);
        ExcelUtil<MonkeyVehicleHistory> util = new ExcelUtil<MonkeyVehicleHistory>(MonkeyVehicleHistory.class);
        util.exportExcel(response, list, "猴车数据历史数据");
    }

    /**
     * 获取猴车数据历史详细信息
     */
    @PreAuthorize("@ss.hasPermi('monkeyVehicleHistory:monkeyVehicleHistory:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(monkeyVehicleHistoryService.selectMonkeyVehicleHistoryById(id));
    }

    /**
     * 新增猴车数据历史
     */
    @PreAuthorize("@ss.hasPermi('monkeyVehicleHistory:monkeyVehicleHistory:add')")
    @Log(title = "猴车数据历史", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MonkeyVehicleHistory monkeyVehicleHistory)
    {
        return toAjax(monkeyVehicleHistoryService.insertMonkeyVehicleHistory(monkeyVehicleHistory));
    }

    /**
     * 修改猴车数据历史
     */
    @PreAuthorize("@ss.hasPermi('monkeyVehicleHistory:monkeyVehicleHistory:edit')")
    @Log(title = "猴车数据历史", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MonkeyVehicleHistory monkeyVehicleHistory)
    {
        return toAjax(monkeyVehicleHistoryService.updateMonkeyVehicleHistory(monkeyVehicleHistory));
    }

    /**
     * 删除猴车数据历史
     */
    @PreAuthorize("@ss.hasPermi('monkeyVehicleHistory:monkeyVehicleHistory:remove')")
    @Log(title = "猴车数据历史", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(monkeyVehicleHistoryService.deleteMonkeyVehicleHistoryByIds(ids));
    }
}
